<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>
// 数组复杂的数据：

// 1.数组中的元素可以是任意数据类型
var arr1 = [123,'hello',true,null,undefined,function (){console.log( '数组中的函数' )},['a','b','c'],{a:111,b:222}];
console.log( arr1[0] );// 123
console.log( arr1[1] );// 'hello'
console.log( arr1[2] );// true
arr1[5]();
console.log( arr1[6][1] );// 'b'
console.log( arr1[7].b );// 222


// 2.多维数组
// var arr2 = [[1,2,3],['a','b','c']];// 二维数组
console.log( arr2[0][1] );// 2
console.log( arr2[1][1] );// 'b'


// 3.对象数组
var arr3 = [
    {name:'海静',age:18},
    {name:'狗蛋',age:19},
    {name:'铁柱',age:20}
];
console.log( arr3[1].name );// '狗蛋'
for (var i = 0; i < arr3.length; i++) {
    // console.log( arr3[i] );// {...}
    console.log( arr3[i].name );// '海静'  '狗蛋'  '铁柱'
}

</script>
</body>
</html>